﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CommonLibrary.Interfaces.Emailer;
using System.Net.Mail;

namespace CommonLibrary.Classes.Emailer
{
    public class EmailerSuccessBase : IEmailerSuccess
    {
        bool _sentSuccessfully;
        MailMessage _sentEmail;
        Exception _errorMessage;
        public bool SentSuccessfully
        {
            get { return _sentSuccessfully; }
        }

        public MailMessage SentEmail
        {
            get { return _sentEmail; }
        }

        public Exception ErrorMessage
        {
            get { return _errorMessage; }
        }

        public EmailerSuccessBase(bool sentSuccessfully, MailMessage sentEmail, Exception errorException = null)
        {
            try
            {
                _sentSuccessfully = sentSuccessfully;
                _sentEmail = sentEmail;
                _errorMessage = errorException;
            }
            catch (Exception error)
            {
                throw new ArgumentNullException("Invalid initialization of the Success Result", error);
            }
        }
    }
}
